package com.cnfangmao.masterdata.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.cnfangmao.masterdata.model.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author chenxd
 * @since 2020-04-17
 */
public interface PermissionDao extends BaseMapper<Permission> {

	@Select("select distinct p.* from t_permission p inner join t_role_permission rp on p.permission_id = rp.permission_id inner join t_account_role ru on ru.role_id = rp.role_id where ru.user_id = #{userId}")
	List<Permission> listPermissionByUserId(String userId);
	
	@Select("select distinct * from t_permission ")
	List<Permission> findAllPermission();
}
